package com.piece.file.preview;

import com.piece.file.support.FileAttribute;
import org.springframework.stereotype.Service;
import org.springframework.ui.Model;
import javax.servlet.http.HttpServletRequest;

/**
 * 处理图片文件
 **/
@Service
public class PictureFilePreview implements FilePreviewHandle {

    @Override
    public String handle(FileAttribute fileAttribute, HttpServletRequest request, Model model, boolean edit) {
        model.addAttribute("name", fileAttribute.getSource().getInstanceName());
        model.addAttribute("value",  fileAttribute.getPath());
        return "/file/picture";
    }
}
